#include "flashin.h"
#include "flash_trans.h"
data_tran tran_buff;



void FLASHin_ReadData(unsigned char *pBuffer,unsigned int ReadAddr,unsigned int NumToWrite){
	
	FLASH_ReadMoreData((ReadAddr+OFFSET_ADDR),pBuffer,NumToWrite);
	
}


void FLASHin_WriteData(unsigned char *pBuffer,unsigned int ReadAddr,unsigned int NumToWrite){
	int i;
	
	memset(tran_buff.buf,0,BOOT_MSC_BLOCK_SIZE);
	for(i=0;i<NumToWrite;i++){
		tran_buff.buf[i]=pBuffer[i];
	}
	if(NumToWrite%4){
		FLASH_Write((ReadAddr+OFFSET_ADDR),tran_buff.data,NumToWrite/4+1);
	}
	else{
		FLASH_Write((ReadAddr+OFFSET_ADDR),tran_buff.data,NumToWrite/4);
	}
	
	
//	FLASH_WriteMoreData((ReadAddr+OFFSET_ADDR),pBuffer,NumToWrite);
}


